1. Field of the Invention
The present invention relates to the technical field of file system and, more particularly, to a journaling file allocation table (FAT) system and the accessing method thereof.
2. Description of Related Art
With the rapid advance of electronic technologies, the developed electronics can provide various applications. An electronic device typically uses a NAND or NOR flash memory as a storage device and stores an operating system in the storage device. The operating system typically supports an FAT file system for the electronic device to connect with a PC. However, a typical FAT file system cannot provide an error correction to avoid a data write failure. Accordingly, when a consumer electronic product with the FAT file system has a power failure or other hardware errors during a write operation, the written data is possibly damaged and cannot be read again.
The FAT32 system is widely used in the current PCs. On the design, the FAT file system is an essential operation platform for a PC-based environment. For a PC, such a data damage can be restored by a software kit such as Scandisk. Thus, the file incompleteness caused by the data write failure is not considered on the system configuration. However, the consumer electronic products are stressed on easy-to-use, so a user has to learn how to use such a software kit like Scandisk in re-implementation of the operating system, which is unreasonable and unacceptable to the most users.
To overcome this, the prior art arranges two same flash memories in mirroring to avoid the write data damage. However, such a way requires more memory space and relatively increases the hardware cost for the consumer electronic products with limited resources.
To overcome the aforementioned problem, the prior art uses a journaling file system. The data management mechanism of the journaling file system can write the data to a prearranged block before a corresponding position in the journaling file system, and the data successfully written to the block is written substantially to the corresponding position at the appropriately selected time.
A storage device of a typical handheld device generally is a flash memory which has a requirement of erasing the old data before a write operation. If the power failure occurs in the handheld device at the moment that the old data is erased while the new one is not written in the corresponding position of the flash memory, the old data is lost and cannot be restored. However, the journaling file system can avoid such a problem, i.e., it ensures to prevent the problem of non-integral data storage caused by an incomplete data update.
In general, a handheld device is implemented with an FAT file system for the communication with a PC and a journaling file system for the data security. Both the FAT file system, such as FAT32, and the journaling file system, such as JFFS, are concurrently implemented in such consumer electronic products, so that the problem of the hardware cost increased in the prior mirroring manner is overcome. However, for a system design, two different file systems are necessarily maintained, and the complexity on the system design is relatively increased.
Therefore, it is desirable to provide an improved file system for a handheld device to mitigate and/or obviate the aforementioned problems.